package com.sykj.wangkun.controller;

import com.sykj.bean.sys.SysMenu;
import com.sykj.util.reponse.CommonEnum;
import com.sykj.util.reponse.ResultBody;
import com.sykj.wangkun.bean.SySMenu;
import com.sykj.wangkun.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: SysMenuController
 * @Package: com.sykj.wangkun.controller
 * @program: BeautyClub
 * @description:
 * @author: Mr.Wang
 * @create: 2020-07-22 11:41
 **/
@CrossOrigin
@RestController
@RequestMapping("/sysmenu")
public class SysMenuController {


    @Autowired
    private SysMenuService sysMenuService;
    /**
     * 功能描述:添加资源表信息
     * @author 姓名
     * @date
     */
    @RequestMapping("/addmenu")
    public ResultBody addmenu(SySMenu sySMenu){
        sysMenuService.save(sySMenu);
        return new ResultBody(CommonEnum.SUCCESS);
    }


    /**
     * 功能描述:查询菜单表信息
     * @author 姓名
     * @date
     */
    @RequestMapping("/querymenu")
    public List querymenu(){
        List<SysMenu> querymenu = sysMenuService.querymenu();
        return querymenu;
    }
    /**
     * 功能描述:修改状态
     * @author 姓名
     * @date
     */
    @RequestMapping("/deletemenu")
    public ResultBody deletemenu(Integer menuId){

        ResultBody deletemenu = sysMenuService.deletemenu(menuId);
        return deletemenu;
    }
    /**
     * 功能描述:查询所有的信息 主菜单左边的导航栏显示
     * @author 姓名
     * @date
     */
    @RequestMapping("/queryall")
    public List queryall(){
        List<SySMenu> list = sysMenuService.list();
        return list;
    }

}
